/**
 * 显示成功提示框
 */
export const showSuccess = (msg, callback) => {
    uni.showToast({
        title: msg,
        icon: 'success',
        mask: true,
        duration: 1500,
        options: {},
        success() {
            callback && callback()
        }
    })
}


/**
 * 显示纯文字提示框
 */
export const showToast = (msg, callback, duration = 1500) => {
    uni.showToast({
        title: msg, // 提示的内容
        icon: 'none',
        mask: true, // 是否显示透明蒙层，防止触摸穿透
        duration: duration, // 提示的延迟时间，单位毫秒，默认：1500
        options: {
            borderRadius: '20px',
        },
        success() {
            setTimeout(() => {
                callback && callback()
            }, duration)
        }
    })
}

/**
 * 显示失败提示框
 */
export const showModal = (msg, callback) => {
    uni.showModal({
        title: '友情提示',
        content: msg,
        success: function (res) {
            if (res.confirm) {
                callback && callback()
            } else if (res.cancel) {
                console.log('取消操作')
            }
        }
    })
}
